package com.esunny.resourcevisualization.controller;

import com.esunny.resourcevisualization.domain.response.ReturnStructure;
import com.esunny.resourcevisualization.service.ResourceCacheInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @version 1.0.0.0
 * @ClassName ResourceCacheInfoController
 * @Description 资源实体缓存信息接口
 * @Author baochencong
 * @Date 2020/11/27 14:49
 */
@Controller
@RequestMapping("/apply")
public class ResourceCacheInfoController {

    @Resource
    private ResourceCacheInfoService resourceCacheInfoService;

    @ResponseBody
    @PostMapping("/remarkResourceDealt")
    public ReturnStructure remarkResourceDealt(@RequestParam("cacheResourceId") int cacheResourceId){
        if (cacheResourceId == 0){
            return ReturnStructure.NOT_FOUND();
        }
        return resourceCacheInfoService.remarkResourceDealt(cacheResourceId);
    }

    @ResponseBody
    @GetMapping("/getResourceCacheInfoById/{cacheResourceId}")
    public ReturnStructure getResourceCacheInfoById(@PathVariable("cacheResourceId") int cacheResourceId){
        if (cacheResourceId == 0){
            return ReturnStructure.NOT_FOUND();
        }
        return ReturnStructure.SUCCESS("获取缓存实体信息成功",resourceCacheInfoService.getResourceCacheInfoById(cacheResourceId));
    }

}
